package utils.graph_utils;

import utils.graph_utils.AStarSearch.Metric;
import utils.math_utils.MathUtils;

import components.Synapse;

public class Edge {

	private final Synapse syn;
	private Node src, targ;
	private double cost;
	private double distance;
	
	public Edge(Synapse syn) {
		this.syn = syn;
		distance = MathUtils.euclideanDist(syn.getSrc().getCoordinates(),
				syn.getTarg().getCoordinates());
	}
	
	
	public void setCost(Metric metric) {
		switch (metric) {
			case DISTANCE: 	cost = distance;
			case DELAY: 	cost = syn.getDelay();
			case STRENGTH:	cost = syn.getStrength(); 
			case BINARY: 	cost =  1.0;
			default:		cost =  1.0;
		}
	}
	
	public double getCost() {
		return cost;
	}
	
	public Synapse getSyn() {
		return syn;
	}


	public Node getSrc() {
		return src;
	}


	public void setSrc(Node src) {
		this.src = src;
	}


	public Node getTarg() {
		return targ;
	}


	public void setTarg(Node targ) {
		this.targ = targ;
	}
	
}
